/*
 * xpack_constants.h - constants for the XPACK compression format
 */

#ifndef LIB_XPACK_CONSTANTS_H
#define LIB_XPACK_CONSTANTS_H

#define MIN_MATCH_LEN			2
#define NUM_REPS			3

#define BLOCKTYPE_VERBATIM		1
#define BLOCKTYPE_ALIGNED		2
#define BLOCKTYPE_UNCOMPRESSED		3

#define NUM_BLOCKTYPE_BITS		3
#define NUM_BLOCKSIZE_BITS		20
#define DEFAULT_BLOCK_SIZE		32768

#define NUM_ALIGNED_BITS		3

#define LITERAL_ALPHABET_SIZE		256
#define LITRUNLEN_ALPHABET_SIZE		16
#define LENGTH_ALPHABET_SIZE		64
#define MAX_OFFSET_ALPHABET_SIZE	32
#define ALIGNED_ALPHABET_SIZE		(1 << NUM_ALIGNED_BITS)

#define MAX_ALPHABET_SIZE		LITERAL_ALPHABET_SIZE

#define MAX_LOG2_NUM_LITERAL_STATES	10
#define MAX_LOG2_NUM_LITRUNLEN_STATES	9
#define MAX_LOG2_NUM_LENGTH_STATES	9
#define MAX_LOG2_NUM_OFFSET_STATES	9
#define MAX_LOG2_NUM_ALIGNED_STATES	7

#define MAX_LOG2_NUM_STATES		MAX_LOG2_NUM_LITERAL_STATES
#define MAX_NUM_STATES			(1 << MAX_LOG2_NUM_STATES)

#define NUM_LITERAL_STREAMS		2

#define MAGIC_FILESIZE			12000000

#define CODEBITS			4
#define MAX_EXTRA_CODEBITS		((1 << CODEBITS) - 3)
#define ZEROCODE1			((1 << CODEBITS) - 2)
#define ZEROCODE2			((1 << CODEBITS) - 1)
#define ZEROCODE1_NBITS			2
#define ZEROCODE2_NBITS			7
#define ZEROCODE1_MIN			1
#define ZEROCODE1_MAX			(ZEROCODE1_MIN + (1 << ZEROCODE1_NBITS) - 1)
#define ZEROCODE2_MIN			(ZEROCODE1_MAX + 1)
#define ZEROCODE2_MAX			(ZEROCODE2_MIN + (1 << ZEROCODE2_NBITS) - 1)

#endif /* LIB_XPACK_CONSTANTS_H */
